﻿using System;
using RuntimeGizmos;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;

namespace Sizebox.CharacterEditor
{
	// Token: 0x02000281 RID: 641
	public class WeldToolDeleteView : BaseAdvancedView
	{
		// Token: 0x06000E18 RID: 3608 RVA: 0x0006DEE2 File Offset: 0x0006C0E2
		protected override void Awake()
		{
			base.Awake();
			this.gizmo = Camera.main.GetComponent<TransformGizmo>();
			this.deleteButton.onClick.AddListener(new UnityAction(this.OnDelete));
		}

		// Token: 0x06000E19 RID: 3609 RVA: 0x0006DF18 File Offset: 0x0006C118
		protected override void OnEnable()
		{
			if (!this.Controller.selectedEntity)
			{
				return;
			}
			this.welder = this.Controller.selectedEntity.GetComponent<WeldTool>();
			if (!this.welder)
			{
				return;
			}
			base.OnEnable();
			base.ShowHandles(this.welder.Keys);
			this.Controller.commandEnabled = false;
		}

		// Token: 0x06000E1A RID: 3610 RVA: 0x0006DF85 File Offset: 0x0006C185
		protected override void OnDisable()
		{
			base.OnDisable();
			this.Controller.commandEnabled = true;
		}

		// Token: 0x06000E1B RID: 3611 RVA: 0x0006DF9C File Offset: 0x0006C19C
		private void OnDelete()
		{
			foreach (SkeletonEditHandle handle in this.handleManager.TargetHandles)
			{
				this.welder.Unweld(handle);
			}
			this.handleManager.DeleteTargets(true);
			base.ShowHandles(this.welder.Keys);
		}

		// Token: 0x04001304 RID: 4868
		[Space]
		[SerializeField]
		private Button deleteButton;

		// Token: 0x04001305 RID: 4869
		private TransformGizmo gizmo;

		// Token: 0x04001306 RID: 4870
		private WeldTool welder;
	}
}
